package tp.pr2.mv.instruction;

import tp.pr2.mv.instruction.instructionNoParametro.*;
import tp.pr2.mv.instruction.instructionNoParametro.instructionCompare.*;
import tp.pr2.mv.instruction.instructionParametro.*;


public class InstructionParser {
	private static Instruction[] instructions = new Instruction[] {
		new Add(),
		new Div(),
		new Dup(),
		new Flip(),
		new Halt(),
		new Mul(),
		new Neg(),
		new Out(),
		new Pop(),
		new Sub(),
		new And(),
		new EqualsTo(),
		new GreaterThan(),
		new LessOrEqual(),
		new LessThan(),
		new Not(),
		new Or(),
		new BranchIfFalse(),
		new BranchIfTrue(),
		new JumpN(),
		new RJumpN(),
		new Load(),
		new Push(),
		new Store(),
	};

	public static Instruction parse(String line) {
		Instruction anyInstr2 = null;

		for (Instruction anyInstr : instructions)
			if (anyInstr2 == null)
				anyInstr2 = anyInstr.parse(line);
		
	return anyInstr2;
	}
}
